import React, { PureComponent } from 'react';
import ProfitOverview from './ProfitOverview';
import 'moment/locale/zh-cn';
import { connect } from 'dva';

class ProfitOverviewC extends PureComponent {
  state = {};
  componentDidMount() {
    console.log('*11111');
    let data = sessionStorage.getItem('profitOverview');
    sessionStorage.removeItem('profitOverview');
    if (data) {
      let obj = JSON.parse(data);
      this.setState({
        params: obj,
      });
    }
  }
  UNSAFE_componentWillReceiveProps(nextPorps) {
    //从用户视图 跳转过来
    console.log('*8888');
    let data = sessionStorage.getItem('profitOverview');
    sessionStorage.removeItem('profitOverview');
    if (data) {
      let obj = JSON.parse(data);
      this.setState({
        params: obj,
      });
    }
  }
  render() {
    return (
      <div>
        <ProfitOverview type='main' params={this.state.params} />
      </div>
    );
  }
}
export default connect(({ profitOverviewM }) => ({
  profitOverviewM,
}))(ProfitOverviewC);
